# -*- encoding=utf8 -*-
__author__ = "Administrator"

from airtest.core.api import *
from poco.drivers.android.uiautomation import AndroidUiautomationPoco
poco = AndroidUiautomationPoco(use_airtest_input=True, screenshot_each_action=False)
x,y = poco.get_screen_size() #获取屏幕分辨率
auto_setup(__file__)
package = "com.ss.android.ugc.aweme"
stop_app(package)
time.sleep(3)
start_app(package)
time.sleep(20)
poco(text='我',touchable=False,selected=False).click()
time.sleep(10)
poco(text='关注',touchable=False,selected=False).click()
while True:
    if poco(text='已关注',touchable=True,selected=False):
        guanzhu_list = poco(text='已关注',touchable=True,selected=False)
        print (len(guanzhu_list))
        for guanzhu in guanzhu_list:
            guanzhu.click()
#             sleep(1)
        swipe((0.5*x,0.8*y),(0.5*x,0.2*y),duration=0.5)
    else:
        swipe((0.5*x,0.8*y),(0.5*x,0.2*y),duration=0.5)